'use strict';
var React = require('react');
class ReLoading extends React.Component {
    constructor(props) {
        super(props);
        this.getMainClass=this.getMainClass.bind(this);
        ReLoading.showLoading=ReLoading.showLoading.bind(this);
        ReLoading.hideLoading=ReLoading.hideLoading.bind(this);
        this.state={
            show:false
        }
    }

    //获取主样式
    getMainClass(){
        if(this.state.show){
            return "ReLoadingBackGround"
        }
        else{
            return "ReLoadingBackGround hide"
        }
    }

    //静态方法，显示loading
    static showLoading(){
        this.setState({
            show:true
        });
    }

    //静态方法，隐藏Loading
    static hideLoading(){
        this.setState({
            show:false
        });
    }

    render(){
        return <div className={this.getMainClass()}>
            <img src="images/pc/loading.gif"/>
        </div>
    }
}

module.exports=ReLoading;